﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>后台主界面</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href='<?php echo $static_url; ?>common/css/reset.css' type="text/css" />
<link rel="stylesheet" href='<?php echo $static_url; ?>common/css/admin.css' type="text/css" />
<link rel="stylesheet" href='<?php echo $static_url; ?>common/css/daily_record.css' type="text/css" />
<script src="<?php echo $static_url; ?>common/js/jquery-1.8.3.min.js" type="text/javascript"></script>
<script src="<?php echo $static_url; ?>common/js/common.js" type="text/javascript"></script>
</head>
<body class="body_background">
	<div>
		<?php echo $header_nav; ?>
		
		<div class="main_content clearfix">
			<div class="crumbs">
				<span class="catalogue">栏目管理</span>
				<a title="栏目列表" href="/www/admin/news/category/category_lists.php">栏目列表</a> |
				<a href="/www/admin/news/category/category_add.php" title="添加一级栏目">添加一级栏目</a> |
				<a href="/www/admin/news/category/category_recover.php">回收站</a>
			</div>
			<div class="daily_record_menu" id="side_container">
				<div class="closeSidebar"><i title="点击隐藏左菜单" class="icon_close"></i></div>
				<ul class="record_menu">
					<li style="font-size:14px;">栏目管理</li>
					<li><a href="/www/admin/news/category/category_lists.php"> └ 栏目列表</a></li>
					<li><a href="/www/admin/news/category/category_add.php"> └ 添加一级栏目</a></li>
					<li><a href="/www/admin/news/category/category_recover.php"> └ 回收站</a></li>
				</ul>
			</div>
			<div class="sidebar_container_hidden" style="margin-top:10px;margin-right:5px;" >
				<div class="openSidebar"><i title="点击显示左菜单" class="icon_open"></i></div>
			</div>
			<div class="daily_record_main" id="main_container">
				<div>
					<table class="record_tips"><tr><td>栏目编辑</td></tr></table>
						<div class="block-body" id="page-stats">
							<form id="form1" name="form1" method="post" action="/www/admin/news/category/do/do_edit.php" onsubmit="return do_submit();">
								<table>
									<tr>
										<td class="news_programa_td">当前栏目:</td>
										<td class="tdpadding">
											<div id="category"></div>
										</td>
									</tr>
									<tr>
										<td class="news_programa_td"><span style="color:#f00;">*</span>栏目名称:</td>
										<td class="tdpadding"><input type="text" class="news_programa_input" name="title" id="title" value="<?php echo $category_rs['title']; ?>" /></td>
									</tr>
									<tr>
										<td class="news_programa_td">栏目名称(英文):</td>
										<td class="tdpadding"> 
											<input type="text" class="news_programa_input" name="title_en" id="title_en" value="<?php echo $category_rs['title_en']; ?>" />
										</td>
									</tr>
									<tr>
										<td class="news_programa_td">SEO关键词:</td>
										<td class="tdpadding">
											<input type="text" class="news_programa_input" name="seo_keyword" id="seo_keyword" value="<?php echo $category_rs['seo_keyword']; ?>"/>
										</td>
									</tr>
									<tr>
										<td class="news_programa_td">SEO描述:</td>
										<td class="tdpadding">
											<textarea rows ="5" cols="50" name="seo_description"><?php echo $category_rs['seo_description']; ?></textarea>
										</td>
									</tr>	
									<tr>
										<td class="news_programa_td">外部链接:</td>
										<td class="tdpadding">
											<input type="text" class="news_programa_input" name="url" id="url" value="<?php echo $category_rs['url']; ?>" />
										</td>
									</tr>	
									<tr>
										<td class="news_programa_td">排序:</td>
										<td class="tdpadding">
											<input type="text" class="news_programa_input" name="orders" id="orders" value="<?php echo $category_rs['orders']; ?>" />
										</td>
									</tr>
									<tr>
										<td colspan="2">
											<input type="hidden" name="id" id="id" value="<?php echo $id; ?>"/>
											<input type="submit" class="btn" name="submit" value="提交" />
										</td>
									</tr>
									<tr><td colspan="2">&nbsp;</td></tr>
								</table>
							</form>
						</div>
				</div>
			</div>
		</div>
	</div>

	<script type="text/javascript">
	//获取栏目
	function category_start(i){<!-- i:id号 -->
		$.ajax({
			type: "POST",
			url: "/admin/news/category/ajax/ajax_start.php",
			dataType:'html',
			data: "id="+i,
			success: function(data){
				$("#category").html("");
				$("#category").append(data);
			}
		});
	}

	$("select[id^='category_']").live("change", function(){
		var i = $(this).val();
		$.ajax({
			type: "POST",
			url: "/admin/news/category/ajax/ajax_get.php",
			dataType:'html',
			data: "id="+i,
			success: function(data){
				$("#category").html("");
				$("#category").append(data);
			}
		});
	});

	//初始化栏目
	category_start(<?php echo $id; ?>);
	
	//提交检测
	function do_submit(){
		if( $('#title').val() == '' ){
			alert('栏目名称不能为空');
			$('#title').focus();
		}else{
			var url = $('#url').val();
			if( url != '' ){
				if( url.length < 7 || url.length > 255 || url.substr(0, 4) != 'http' ){
					alert("外部链接地址必须以http开头且字符长度不能小于7或大于256！");
					$('#url').focus();
					return false;
				}
			}
			return true;
		}
		return false;
	}
	</script>
</body>
</html>